package string;
import java.util.Scanner;
import java.util.Random;
public class Test {
    public static void main(String[] args) {
        String a="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        Random b=new Random();
        String c="";
        for (int i=0;i<4;i++){
            int d=b.nextInt(a.length());
            char e=a.charAt(d);
            c+=e;
        }
        System.out.println("验证码"+c);
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入上述验证码");
        String q=scanner.nextLine();
        if (c.equalsIgnoreCase(q)){
            System.out.println("通过");
        }else{
            System.out.println("失败");
        }
    }
}